<template>
	<view class="container">
		<web-view :src="url" @message="handleGetMessage"></web-view>
		
	</view>
</template>
<script>
    export default {
        name: "",
        components:{
            
        },
		data(){
		    return {
		        url:'',
				orderNo:''
				
		    }
		},
		onLoad(options) {
			let _this = this
			this.orderNo = options.oid
			this.$nextTick(function(){
				_this.url = _this.$SysCache.get("tempURl")
			})
			// setTimeout(function(){
			// 	_this.url = _this.$SysCache.get("tempURl")
			// },100)
			
		},
		methods:{
			handleGetMessage(evt){
				// console.log('接收到的消息1：' + JSON.stringify(evt.detail.data));
				let payData =JSON.parse((evt.detail.data)[0].result)
				
				uni.requestPayment({
				    provider: 'wxpay',
				    timeStamp: payData.timeStamp,
				    nonceStr: payData.nonceStr,
				    package: payData.package,
				    signType: payData.signType,
				    paySign: payData.paySign,
				    success: function (res) {
				        uni.navigateTo({
				        	url: `/pages/order/success?cOrderNo=${that.orderNo}&type=1`
				        })
				    },
				    fail: function (err) {
				        console.log('fail:' + JSON.stringify(err));
				    }
				});
			}
			
			
			
		}
      

    }
	

</script>


<style scoped lang="less">

</style>
